﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Meqs.Entity;
using Meqs.Logic.Interface;

namespace Meqs.Logic.Implement
{
    public class ExamTeachSchoolLogic : CommonLogic<ExamTeachSchool, int>, IExamTeachSchoolLogic
    {
        #region Implementation of ICommonLogic<ExamTeachSchool, int>

        /// <sammury>
        /// 创建对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Create(ExamTeachSchool entity)
        {
            return CreateObject(entity);
        }

        /// <sammury>
        /// 更新对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(ExamTeachSchool entity)
        {
            return UpdateObject(entity);
        }

        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="entityId"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int Delete(int entityId, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("RID", entityId);
            ht.Add("SchoolMark", schoolMark);
            return DeleteCustomer("ExamTeachSchool.Delete", ht);
        }

        /// <summary>
        /// 删除所有对象
        /// </summary>
        /// <returns></returns>
        public int DeleteAll(string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("SchoolMark", schoolMark);
            return DeleteCustomer("ExamTeachSchool.Delete", ht);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="entityId"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public ExamTeachSchool FindById(int entityId, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("RID", entityId);
            ht.Add("SchoolMark", schoolMark);
            return FindCustomerByID<ExamTeachSchool>("ExamTeachSchool.FindById", ht);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int FindCount(string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("SchoolMark", schoolMark);
            return FindCustomerByCount("ExamTeachSchool.FindCount", ht);
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public IList<ExamTeachSchool> FindAll(string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("SchoolMark", schoolMark);
            return FindCustomer<ExamTeachSchool>("ExamTeachSchool.Find", ht);
        }

        /// <summary>
        /// 检索对象数量
        /// </summary>
        /// <returns></returns>
        public int FindCount(Hashtable table)
        {
            return FindObjectByCount(table);
        }

        /// <sammury>
        /// 检索对象
        /// </sammury>
        public IList<ExamTeachSchool> FindAll(Hashtable table)
        {
            return FindObject(table);
        }

        #endregion

        #region Implementation of IExamTeachSchoolLogic

        /// <sammury>
        /// 创建对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int Create(ExamTeachSchool entity, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("ExamTeachSchool", entity);
            ht.Add("SchoolMark", schoolMark);
            return (int) InsertCustomer("ExamTeachSchool.InsertExamTeachSchool", ht);
        }

        /// <sammury>
        /// 更新对象
        /// </sammury>
        /// <param name="entity"></param>
        /// <param name="schoolMark"></param>
        /// <returns></returns>
        public int Update(ExamTeachSchool entity, string schoolMark)
        {
            Hashtable ht = new Hashtable();
            ht.Add("ExamTeachSchool", entity);
            ht.Add("SchoolMark", schoolMark);
            return UpdateCustomer("ExamTeachSchool.UpdateExamTeachSchool", ht);
        }
        public int Delete(Hashtable ht)
        {
            try
            {
                return ExecuteDelete("ExamTeachSchool.DeleteBy", ht);
            }
            catch (Exception ex)
            {

                throw;
            }
        }
        #endregion
    }
}
